<?php echo $header; ?>
<?php echo $column_left; ?>
<div id="content">
	<div class="page-header">
    	<div class="container-fluid">
        	<div class="pull-right">
            	<button type="submit" id="btn_save" form="form-product" data-toggle="tooltip" title="" class="btn btn-primary" data-original-title="Save"><i class="fa fa-save"></i></button>
                <a href="<?php echo $cancel; ?>" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="Cancel"><i class="fa fa-reply"></i></a>
            </div>
            <h1> <?php echo $heading_title; ?> </h1>
            <ul class="breadcrumb">
            	<?php foreach ($breadcrumbs as $breadcrumb) { ?>
					<li> <?php echo $breadcrumb['separator']; ?><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text']; ?></a></li>
    			<?php } ?>
            </ul>
        </div><!-- container-fluid -->
    </div><!-- page-header -->
    <div class="container-fluid">
		<?php if ($error_warning) { ?>
            <div class="alert alert-danger"><i class="fa fa-exclamation-circle"></i> <?php echo $error_warning; ?>
              <button type="button" class="close" data-dismiss="alert">&times;</button>
            </div>
        <?php } ?>  
        <div class="panel panel-default">
        	<div class="panel-heading">
            	<h3 class="panel-title"><i class="fa fa-pencil"></i><?php echo $heading_title; ?></h3>
            </div>
            <div class="panel-body">
            	<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data" id="form" class="form-horizontal">
                	<ul class="nav nav-tabs">
                    	<li class="active"> <a href="#tab-general" data-toggle="tab"><?php echo $tab_general; ?></a></li>
                        <li> <a href="#tab-links" data-toggle="tab"><?php echo $tab_data; ?></a></li>
                        <li> <a href="#tab-design" data-toggle="tab"><?php echo $tab_design; ?></a> </li>
                    </ul>
                    <div class="tab-content">
                    	<div class="tab-pane active" id="tab-general">
                        	<ul class="nav nav-tabs" id='language'>
                            	<?php $i=0; foreach ($languages as $language) {$i++; ?>
            						<li <?php echo ($i ==1)?"class='active'":""?>> <a href="#language<?php echo $language['language_id']; ?>"><img src="view/image/flags/<?php echo $language['image']; ?>" title="<?php echo $language['name']; ?>" /> <?php echo $language['name']; ?></a></li>
            					<?php } ?>
                            </ul>
                             <?php $lang=0; foreach ($languages as $language) {$lang++; ?>
                             	<div class="tab-content" >
                                	<div class="tab-pane <?php echo ($lang==1)?"active":""?>" id="language<?php echo $language['language_id']; ?>">
                                    	<div class="form-group required">
                                         	<label class="col-sm-2 control-label"><?php echo $entry_name; ?></label>
                                            <div class="col-sm-10">
                                            	<input type="text" name="blogs_category_description[<?php echo $language['language_id']; ?>][name]" id="blogs_category_description<?php echo $language['language_id']; ?>_name" onkeyup="trim_name(this.id);" size="100" value="<?php echo isset($blogs_category_description[$language['language_id']]) ? $blogs_category_description[$language['language_id']]['name'] : ''; ?>" class="form-control" />
                                                <?php if (isset($error_name[$language['language_id']])) { ?>
                                                	<span class="error"><?php echo $error_name[$language['language_id']]; ?></span>
                                                <?php } ?>
                                            </div>
                                         </div><!-- form-group  -->
                                         <div class="form-group">
                                         	<label class="col-sm-2 control-label"><?php echo $entry_description; ?></label>
                                            <div class="col-sm-10">
                                            	<textarea class="form-control" name="blogs_category_description[<?php echo $language['language_id']; ?>][description]" id="description<?php echo $language['language_id']; ?>"><?php echo isset($blogs_category_description[$language['language_id']]) ? $blogs_category_description[$language['language_id']]['description'] : ''; ?></textarea>
                                            </div>
                                         </div><!-- form-group  -->
                                         <div class="form-group">
                                         	<label class="col-sm-2 control-label"><?php echo $entry_meta_description; ?></label>
                                            <div class="col-sm-10">
                                            	<textarea class="form-control"  name="blogs_category_description[<?php echo $language['language_id']; ?>][meta_description]" cols="40" rows="5"><?php echo isset($blogs_category_description[$language['language_id']]) ? $blogs_category_description[$language['language_id']]['meta_description'] : ''; ?></textarea>
                                            </div>
                                         </div><!-- form-group  -->
                                         <div class="form-group">
                                         	<label class="col-sm-2 control-label"><?php echo $entry_meta_keyword; ?></label>
                                            <div class="col-sm-10">
                                            	<textarea class="form-control" name="blogs_category_description[<?php echo $language['language_id']; ?>][meta_keyword]" cols="40" rows="5"><?php echo isset($blogs_category_description[$language['language_id']]) ? $blogs_category_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>
                                            </div>
                                         </div><!-- form-group  -->
                                    </div>
                                </div>
                             <?php }?>
                        </div><!-- tab-general -->
                        <div class="tab-pane" id="tab-links">
                        	<style>.input-checkbox{border:1px solid #CECECE;background:#F0F0F0;padding:10px;height: 120px;width: 320px;overflow-y:scroll}.input-checkbox input{margin-left:20px;margin-right:10px;}.scrollbox {border: 1px solid #CCCCCC;width: 350px;height: 100px;background: #FFFFFF;overflow-y: scroll;padding:10px}</style>
                            <div class="form-group required">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_parent; ?> </label>
                                <div class="col-sm-9">
                            		<select class="form-control" name="parent_id">
                                      <option value="0"><?php echo $text_none; ?></option>
                                      <?php foreach ($categories as $category) { ?>
                                      <?php if ($category['blogs_category_id'] == $parent_id) { ?>
                                      <option value="<?php echo $category['blogs_category_id']; ?>" selected="selected"><?php echo $category['name']; ?></option>
                                      <?php } else { ?>
                                      <option value="<?php echo $category['blogs_category_id']; ?>"><?php echo $category['name']; ?></option>
                                      <?php } ?>
                                      <?php } ?>
                                    </select>
                                </div>
                            </div><!-- form-group -->
                            <div class="form-group required">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_store; ?> </label>
                                <div class="col-sm-9">
                            			<div class="scrollbox">
                                      <?php $class = 'even'; ?>
                                      <div class="<?php echo $class; ?>">
                                        <?php if (in_array(0, $blogs_category_store)) { ?>
                                        <input type="checkbox" name="blogs_category_store[]" value="0" checked="checked" />
                                        <?php echo $text_default; ?>
                                        <?php } else { ?>
                                        <input type="checkbox" name="blogs_category_store[]" value="0" />
                                        <?php echo $text_default; ?>
                                        <?php } ?>
                                      </div>
                                      <?php foreach ($stores as $store) { ?>
                                      <?php $class = ($class == 'even' ? 'odd' : 'even'); ?>
                                      <div class="<?php echo $class; ?>">
                                        <?php if (in_array($store['store_id'], $blogs_category_store)) { ?>
                                        <input type="checkbox" name="blogs_category_store[]" value="<?php echo $store['store_id']; ?>" checked="checked" />
                                        <?php echo $store['name']; ?>
                                        <?php } else { ?>
                                        <input type="checkbox" name="blogs_category_store[]" value="<?php echo $store['store_id']; ?>" />
                                        <?php echo $store['name']; ?>
                                        <?php } ?>
                                      </div>
                                      <?php } ?>
                                    </div><!-- scrollbox -->
                                </div>
                            </div><!-- form-group -->
                            <div class="form-group required">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_keyword; ?> </label>
                                <div class="col-sm-9">
                            		<input class="form-control" type="text" name="keyword" id="seo_keyword" value="<?php echo $keyword; ?>" />
                                </div>
                            </div><!-- form-group -->
							<div class="form-group">
                                <label class="col-sm-2 control-label" for="input-image"><?php echo $entry_image; ?></label>
                                <div class="col-sm-10">
                                  <a href="" id="thumb-image" data-toggle="image" class="img-thumbnail"><img src="<?php echo $thumb; ?>" alt="" title=""  /></a>
                                  <input type="hidden" name="image" value="<?php echo $image; ?>" id="input-image" />
                                </div>
                            </div>
                            <div class="form-group">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_top; ?> </label>
                                <div class="col-sm-9">
                            		<?php if ($top) { ?>
                                    <input type="checkbox" name="top" value="1" checked="checked" />
                                    <?php } else { ?>
                                    <input type="checkbox" name="top" value="1" />
                                    <?php } ?>
                                </div>
                            </div><!-- form-group -->
                            <div class="form-group">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_column; ?> </label>
                                <div class="col-sm-9">
                            		<input class="form-control" type="text" name="column" value="<?php echo $column; ?>" size="1" />
                                </div>
                            </div><!-- form-group -->
                            <div class="form-group">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_sort_order; ?> </label>
                                <div class="col-sm-9">
                            		<input class="form-control" type="text" name="sort_order" value="<?php echo $sort_order; ?>" size="1" />
                                </div>
                            </div><!-- form-group -->
                            <div class="form-group">
                            	<label class="col-sm-2 control-label"> <?php echo $entry_status; ?> </label>
                                <div class="col-sm-9">
                            		<select name="status" class="form-control">
                                      <?php if ($status) { ?>
                                      <option value="1" selected="selected"><?php echo $text_enabled; ?></option>
                                      <option value="0"><?php echo $text_disabled; ?></option>
                                      <?php } else { ?>
                                      <option value="1"><?php echo $text_enabled; ?></option>
                                      <option value="0" selected="selected"><?php echo $text_disabled; ?></option>
                                      <?php } ?>
                                    </select>
                                </div>
                            </div><!-- form-group -->
                        </div><!-- tab-links -->
                        <div class="tab-pane" id="tab-design">
                        	 <div class="form-group">
                            	<label class="col-sm-2 control-label"><?php echo $text_default; ?></label>
                                <div class="col-sm-9">
                 					<select name="blogs_layout[0][layout_id]" class="form-control">
                                        <option value=""></option>
                                        <?php foreach ($layouts as $layout) { ?>
                                        <?php if (isset($blogs_layout[0]) && $blogs_layout[0] == $layout['layout_id']) { ?>
                                        <option value="<?php echo $layout['layout_id']; ?>" selected="selected"><?php echo $layout['name']; ?></option>
                                        <?php } else { ?>
                                        <option value="<?php echo $layout['layout_id']; ?>"><?php echo $layout['name']; ?></option>
                                        <?php } ?>
                                        <?php } ?>
                                    </select>
                                </div><!-- col-sm-9 -->
                             </div><!-- form-group -->
                             <?php foreach ($stores as $store) { ?>
                             	<div class="form-group">
                                	<label class="col-sm-2 control-label"><?php echo $store['name']; ?></label>
                                    <div class="col-sm-9">
                                    	<select name="blogs_layout[<?php echo $store['store_id']; ?>][layout_id]" class="form-control">
                                            <option value=""></option>
                                            <?php foreach ($layouts as $layout) { ?>
                                            <?php if (isset($blogs_layout[$store['store_id']]) && $blogs_layout[$store['store_id']] == $layout['layout_id']) { ?>
                                            <option value="<?php echo $layout['layout_id']; ?>" selected="selected"><?php echo $layout['name']; ?></option>
                                            <?php } else { ?>
                                            <option value="<?php echo $layout['layout_id']; ?>"><?php echo $layout['name']; ?></option>
                                            <?php } ?>
                                            <?php } ?>
                                        </select>
                                    </div>
                                </div>
                             <?php }?>
                        </div>
                    </div>
                </form>
            </div>
        </div> 	
    </div>
</div>
<?php echo $footer; ?>
<script language="javascript">
	$("#btn_save").click(function(){$("#form").submit();});
	$('#description1').summernote({height: 300});
</script>